﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using YWTSSys.Library;
using YWTSSys.BLL;

namespace YWTSSys.Web.MachineSys.SysBasic
{
    public partial class OUser_EditPwd : PageBase
    {
       protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "editpwd")
            {
                addmenu();
            }
        }

       protected void addmenu()
       {
           string oldPassword = GetRequestValue<string>("oldPassword");
           string newPassword = GetRequestValue<string>("newPassword");
           oldPassword = StringHelper.GetPwdEncrypt(oldPassword);
           newPassword = StringHelper.GetPwdEncrypt(newPassword);
           if (oldPassword != User.PassWord)
           {
               AlertJson("对不起,您输入的旧密码错误 ,请重新输入");
               return;
           }
           if (OUserController.EditPwd(User.UserId, newPassword))
               SuccessJson("已成功修改您的密码");
           else
               ErrorJson("修改失败");
       }
        protected override string DWZRef
        {
            get { return ""; }
        }
    }
}